
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>目前准备做数据库水平切分，需要注意什么关键问题？ - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>目前准备做数据库水平切分，需要注意什么关键问题？ - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">策略</div>
          <div class="card-question">在数据库水平切分中，选择一个优秀的分片键需要满足哪两个核心标准？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">策略</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">首先，分片键应基于业务需求选择，以确保大多数查询能在单个分片上完成，减少跨分片查询；其次，分片键应能均匀分布数据，避免某些分片过载而其他分片空闲的情况。</div>
          </div>
          <div class="card-source">来源: 1. 分片策略选择</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">文档中提到了哪三种常见的分片规则？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">文档中提到的三种分片规则是：范围分片（根据时间或数值范围）、哈希分片（通过对分片键进行哈希计算）和列表分片（根据具体的列表如地区或部门）。</div>
          </div>
          <div class="card-source">来源: 1. 分片策略选择</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">对于分片后可能涉及多个分片的事务，有哪些管理方法来保证数据一致性？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">可以使用分布式事务管理工具（如XA、TCC、SAGA）来保证强一致性。对于要求不高的场景，也可以采用最终一致性策略来降低复杂性。</div>
          </div>
          <div class="card-source">来源: 2. 分片后的数据一致性</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">实践</div>
          <div class="card-question">在分片数据库中，应该如何处理跨分片查询？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">实践</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">应尽量避免跨分片查询。如果无法避免，必须确保查询效率，例如可以借助分布式查询引擎来完成。</div>
          </div>
          <div class="card-source">来源: 3. 查询和索引设计</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">策略</div>
          <div class="card-question">为了在系统升级时避免全局停机，文档推荐采用什么策略？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">策略</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">文档推荐采用滚动升级策略，这样可以逐步升级分片中的数据和服务，从而避免系统全局停机。</div>
          </div>
          <div class="card-source">来源: 4. 数据迁移和升级</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">在分库分表架构中，需要考虑哪两种类型的负载均衡？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">需要考虑两种负载均衡：一是分片负载均衡，确保负载在各分片间均匀分布；二是请求负载均衡，使用负载均衡器优化请求的分配。</div>
          </div>
          <div class="card-source">来源: 5. 负载均衡</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">实践</div>
          <div class="card-question">在为分片数据库制定备份策略时，除了定期备份，还需要关注哪个关键点以确保数据恢复的可靠性？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">实践</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">除了定期备份，还必须确保备份数据的一致性和完整性，以防止因备份不一致而导致的数据恢复问题。</div>
          </div>
          <div class="card-source">来源: 6. 备份与恢复</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">为了应对分片可能发生的故障，可以设计哪些容错机制？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">可以设计诸如备用分片或故障转移等容错机制来应对分片故障。</div>
          </div>
          <div class="card-source">来源: 7. 系统监控和故障处理</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在分片数据库中，可以通过哪些措施来保障数据本身的安全性？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">可以通过两种主要措施保障数据安全：一是进行访问控制，确保只有授权用户能访问数据；二是对存储在分片中的敏感数据进行加密。</div>
          </div>
          <div class="card-source">来源: 8. 安全性</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
